﻿using System;
using Archie.Retail.Data;
using Archie.Retail.Data.SterlingStorage;

namespace Archie.Retail.WebApp.Controllers
{
    public class DataManagerLocator
    {
        private static readonly Lazy<IDataManager> _instance = new Lazy<IDataManager>(() => new SterlingDataManager(GetDbName()));

        public static IDataManager DataManager
        {
            get
            {
                return _instance.Value;
            }
        }

        private static string GetDbName()
        {
            return System.Configuration.ConfigurationManager.AppSettings["dbPath"];
        }
    }
}
